package com.demo.fulllink.api;

import com.demo.fulllink.module.po.AccountPO;
import com.demo.fulllink.module.vo.ResponseVO;
import com.demo.fulllink.service.AccountService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/accountapi")
public class AccountAPIController {
    
    private Logger log = LoggerFactory.getLogger(AccountAPIController.class);
    @Autowired
    private AccountService accountService;
    
    @RequestMapping("/checkAccount/{accountId}")
    public ResponseVO checkAccount(@PathVariable("accountId") String accountId) {
        log.info("account 服务 检查开始");
        return accountService.checkAccount(accountId);
    }
    
    @RequestMapping("/getAccount/{accountId}")
    public AccountPO getAccount(@PathVariable("accountId") String accountId) {
        return accountService.findById(accountId);
    }
    
    @RequestMapping("/findAccountByName/{accountName}")
    public AccountPO findAccountByName(@PathVariable("accountName") String accountName) {
        return accountService.findByName(accountName);
    }
    
}
